package aex.service;



import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import aex.dao.CommentArticleDao;
import aex.domain.CategoryEditer;
import aex.domain.CommentArticle;
import aex.util.PageBean;



@Transactional(readOnly = false)
@Service(CommentArticleService.SERVICE_NAME)

public class CommentArticleService  {

	
	public static final String SERVICE_NAME="aex.service.CommentArticleService";
	/**
	 * 以注解的形式让spring为我们注入dao的实现类
	 */
	@Resource(name = CommentArticleDao.SERVICE_NAME)
	public CommentArticleDao dao;
	
	public CommentArticleService() {
		
	}
	public CommentArticle findByID(Serializable id) {
		return dao.findObjectByID(Integer.parseInt(id+""));
	}
	public void deleteById(Serializable id) {
		dao.deleteObjectByIDs(Integer.parseInt(id+""));
	}
	public void save(CommentArticle obj) {
		dao.save(obj);
	}
	public void update(CommentArticle obj) {
		dao.merge(obj);
	}
	public PageBean<CommentArticle> findByArticle(
			PageBean<CommentArticle> pageBean, int arId) {
		LinkedHashMap<String, String> orderby=new LinkedHashMap<String, String>();
		orderby.put("tName.caTime", "desc");
		return dao.findPageBean("and tName.article = "+arId , null, orderby, pageBean);
	}
}
